package
{
	import capricornus.config.ConfigLocator;
	
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.net.FileReference;
	
	public class ConfigTest extends Sprite
	{
		public function ConfigTest()
		{
			super();
			init();
		}
		
		private function init():void
		{
			stage.addEventListener( MouseEvent.CLICK, onClick );
		}
		
		private var _fs:FileReference;
		private function onClick( e:MouseEvent ):void
		{
			if( _fs==null )
			{
				_fs = new FileReference();
				_fs.addEventListener( Event.COMPLETE, onComplete );
				_fs.addEventListener( Event.SELECT, onSelect );
			}
			_fs.browse();
		}
		
		private function onSelect( e:Event ):void
		{
			_fs.load();
		}
		
		private function onComplete( e:Event ):void
		{
			 ConfigLocator.initialize( _fs.data );
			 
			 var str:String = ConfigLocator.getXML("goalGuide.xml");
			 var xml:XML = new XML( str );
			 trace( xml.toString() );
		}
	}
}